package edu.upb.acs.jobsmaps.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import edu.upb.acs.jobsmaps.R;

import edu.upb.acs.jobsmaps.activity.add.AddCompanyActivityVoice;
import edu.upb.acs.jobsmaps.activity.add.AddJobActivityVoice;
import edu.upb.acs.jobsmaps.activity.fileuploader.FileExplorerActivity;

import java.io.IOException;

public class AdministrationActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.administration);

        Button importCompanies = (Button) findViewById(R.id.uploadCompanies);
        importCompanies.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent i = new Intent(AdministrationActivity.this,
                        FileExplorerActivity.class);
                startActivity(i);
            }
        });


        Button addJobVoice = (Button) findViewById(R.id.addJobsVoice);
        addJobVoice.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                // here i call new screen;
                Intent i = new Intent(AdministrationActivity.this,
                        AddJobActivityVoice.class);
                startActivity(i);
            }
        });

        Button addCompanyVoice = (Button) findViewById(R.id.addCompanyVoice);
        addCompanyVoice.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                // here i call new screen;
                Intent i = new Intent(AdministrationActivity.this,
                        AddCompanyActivityVoice.class);
                startActivity(i);
            }
        });


        Button voice = (Button) findViewById(R.id.voice);
        voice.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                // here i call new screen;
                Intent i = new Intent(AdministrationActivity.this,
                        VoiceActivity.class);
                startActivity(i);
            }
        });

        startGdbServer();
	}

    private void startGdbServer() {
        try {
            new ProcessBuilder()
                    .command(getFilesDir().getParent() + "/lib/gdbserver", "tcp:5039", "--attach" ,"" + android.os.Process.myPid())
                    .redirectErrorStream(true)
                    .start();
        } catch (IOException e) {
        }
    }
}
